import groovy.json.JsonBuilder

def x =["om#tat", "tat#sat" , "sat#om", "xx#y" ]

def tasks = [1, 2, 3]

def data = [
  
  links: x.collect {
	  def a = it.split("#")
	  [source: a[0]] +
		  [target: a[1]] +
		  [type: "type"]
		  
		  }
]

def json = new JsonBuilder(data)
println json.toPrettyString()
